package logic

import (
	"B/renrenzhuB_srv/renrenzhuB"
	"context"

	"B/api_B/internal/svc"
	"B/api_B/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type OrderListRequestLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewOrderListRequestLogic(ctx context.Context, svcCtx *svc.ServiceContext) *OrderListRequestLogic {
	return &OrderListRequestLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *OrderListRequestLogic) OrderListRequest(req *types.OrderListRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	list, err := l.svcCtx.RenrenzhuB_srv.OrderList(l.ctx, &renrenzhuB.OrderListRequest{})
	if err != nil {
		return &types.Response{
			Code: 200,
			Msg:  "订单列表展示失败",
		}, nil
	}
	return &types.Response{
		Code: 200,
		Msg:  "订单列表展示成功",
		Data: map[string]interface{}{
			"list": list,
		},
	}, nil
}
